import VueRouter from "vue-router";
import Vue from "vue";

Vue.use(VueRouter)

const Home = ()=>import("@/pages/Home")
const Login = ()=>import("@/pages/Login")
const NotFound = ()=>import("@/pages/NotFound")
const News = ()=>import("@/pages/Home/News")
const Game = ()=>import("@/pages/Home/Game")
const Music = ()=>import("@/pages/Home/Music")
const MusicDetail = ()=>import("@/pages/Home/Music/MusicDetail")


const router = new VueRouter({
    mode:"history",
    routes:[
        {
          path:"",
          redirect:"/home"
        },
        {
            path:"/home",
            component:Home,
            children:[
                {
                  path:"",
                  redirect:"news"
                },
                {
                    path:"news",
                    name:"News",
                    component:News
                },
                {
                    path:"music",
                    name:"Music",
                    component:Music,
                    children:[
                        {
                            path:"musicdetail/:id/:age",
                            component:MusicDetail,
                            name:"MusicDetail"
                        }
                    ]
                },
                {
                    path:"game",
                    name:"Game",
                    component:Game
                },
            ]
        },
        {
            path:"/login",
            component:Login,
        },
        {
            path:"/*",
            component:NotFound
        }
    ]
})

export default router